using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;

namespace CustomersSuppliersDataLayer
{
    public class Settings
    {
        private DbConnection connection = null;
        public DbConnection Connection
        {
            get
            {
                if (connection == null)
                {
                    connection = CustomersSuppliersDataLayer.DataBaseConnections.CustomersSuppliers.Factory.CreateConnection();
                    connection.ConnectionString = CustomersSuppliersDataLayer.DataBaseConnections.CustomersSuppliers.ConnectionString;
                }
               return connection;
            }
            set
            {
               connection = value;
           }
        }

        private DbTransaction transaction = null;
        public DbTransaction Transaction
        {
            get
            {
               return transaction;
            }
            set
            {
               transaction = value;
            }
        }

        private DbCommand command = null;
        public DbCommand Command
        {
            get
            {
               return command;
            }
            set
            {
               command = value;
            }
        }

        private DbDataAdapter adapter = null;
        public DbDataAdapter Adapter
        {
            get
            {
               return adapter;
            }
            set
            {
               adapter = value;
            }
        }


        private List<DbParameter> parameters = new List<DbParameter>();
        public List<DbParameter> Parameters
        {
            get { return parameters; }
        }

        public Settings()
        {

        }


        private bool enableDeleteAllRows = false;
        public bool EnableDeleteAllRows
        {
            get { return enableDeleteAllRows; }
            set { enableDeleteAllRows = value; }
        }


        public Settings(DbConnection connection, DbTransaction transaction, DbCommand command, DbDataAdapter adapter, bool enableDeleteAllRows)
        {
            this.connection = connection;
            this.transaction = transaction;
            this.command = command;
            this.adapter = adapter;
            this.enableDeleteAllRows = enableDeleteAllRows;
        }

    }
}
